<?php
        define("GRID_SOURCE", "");
        
        include(GRID_SOURCE."class/gridclasses.php"); //Include the grid engine.
        
        session_start();
		require_once "../funciones.php";
       
        $grid_id = array("grid");

        unset($_SESSION["grid"]);
        include(GRID_SOURCE."class/gridcreate.php"); //Creates grid objects.
        
?>
<html>
        <head>
                <title>Invefisico de Partes</title>
                <script language="Javascript" type="text/javascript" src="<?php print(GRID_SOURCE);?>javascript/javascript.js"></script>
                <link href="<?php print(GRID_SOURCE);?>css/style.css" rel="stylesheet" type="text/css" />
				<script type='text/javascript' src="<?php print(GRID_SOURCE);?>server.php?client=all"></script>
				<script>
				HTML_AJAX.defaultServerUrl = '<?php print(GRID_SOURCE);?>server.php';
				</script>
        <script src="../js/jquery.js" type="text/javascript"></script>
		<script>
        function validar(e,serial)
        {
            var tecla7;
        	
        	    if (document.all) { tecla7 = e.keyCode;  }
        	    else {  tecla7 = e.which; }
        	    
        	    if (tecla7 == 13) 
        		{ 
        			if ($('#calidad', top.document).attr('value') == 'XXX')
        			{
        				alert('Debe seleccionar una Calidad');
        				$('#calidad', top.document).focus(); 
        			}
        			else
        			{
        				if ($('#subclasefisico', top.document).attr('value') == 'XXX')
        				{
        					alert('Debe seleccionar un Item');
        					$('#subclasefisico', top.document).focus();
        				}
        				else
        					location.href="adiciona_fisico2.php?serial="+serial;	
        			}
        		}
        	    else
        		{ return false; }
        }
        </script>
        </head>

        <body onload="document.getElementById('Editbox1').focus();">

	<?php

	if ($_SESSION['caweb']['iniciar'] == 1)
	{
	?>
		Interno o Serial:<input type="text" id="Editbox1" onkeypress="validar(event,this.value);" size="15" name="Editbox1" value="" />
    <?php
			echo  "Ultimo Interno ".$_SESSION['caweb']['ultimointerno'];
		 	if ($_SESSION['caweb']['resultado'] == 1) { echo "<font size=4 color=green><b> CORRECTO </b></font>"; }
   			if ($_SESSION['caweb']['resultado'] == 3) { echo "<font size=4 color=red><b> INTERNO EN TRANSACCION ACTUAL </b></font>"; }
            if ($_SESSION['caweb']['resultado'] == 5) { echo "<font size=4 color=orange><b> Aun No hay autorizacion para Empezar </b></font>"; }

			$username=$_SESSION['caweb']['username'];
			$sucursal=$_SESSION['caweb']['sucursal'];
			$bodega=$_SESSION['caweb']['bodega'];

			$condicion="usuariocreo='$username' AND sucursal_f='$sucursal' AND bodega_f='$bodega'";

            $_SESSION["grid"]->SetDatabaseConnection($_SESSION['caweb']['basededatos'], "caweb", "caweb");
			$_SESSION["grid"]->SetSqlSelect('id,interno,item_f,sucursal_f,bodega_f,calidad_f', 'temporal_fisico2',$condicion);
			$_SESSION["grid"]->SetUniqueDatabaseColumn("id", true);
			$_SESSION["grid"]->SetTitleName("Interno para Inventario de Partes");
			$_SESSION["grid"]->SetEditModeEdit(true);
			$_SESSION["grid"]->SetMaxRowsEachPage(30);
       	    $_SESSION["grid"]->SetDatabaseColumnEditable("id", false);
			$_SESSION["grid"]->SetDatabaseColumnEditable("interno", true);
            $_SESSION["grid"]->SetDatabaseColumnEditable("sucursal_f", true);
			$_SESSION["grid"]->SetDatabaseColumnEditable("calidad_f", true);
			$_SESSION["grid"]->SetDatabaseColumnEditable("bodega_f", true);
			$_SESSION["grid"]->SetDatabaseColumnEditable("item_f", true);
			$_SESSION["grid"]->SetShowExcelIco(false);
			$_SESSION["grid"]->SetShowPrintIco(true);
			$_SESSION["grid"]->PrintGrid(MODE_EDIT);
	}
    ?>
</body> 
</html>
